package com.wbao.dianniu.db;

import com.wbao.dianniu.gen.TencentUserBeanDao;

import java.util.List;

/**
 * Created by yejianjun on 2018/8/17.
 */

public class TencentUserHelper {

    /**
     * 添加数据，如果有重复则覆盖
     *
     * @param userBean
     */
    public static long insertTencentUser(TencentUserBean userBean) {
        long ret = GreenDaoManager.getInstance().getmDaoSession().insertOrReplace(userBean);
        return ret;
    }

    /**
     * 删除数据
     *
     * @param identify
     */
    public static void deleteTencentUser(String identify) {
        GreenDaoManager.getInstance().getmDaoSession().delete(identify);
    }

    /**
     * 更新数据
     */
    public static void updateTencentUser(TencentUserBean userBean) {
        GreenDaoManager.getInstance().getmDaoSession().update(userBean);
    }

    /**
     * 查询identify的所有数据
     *
     * @return
     */
    public static List<TencentUserBean> queryTencentUser(String identify) {

        return GreenDaoManager.getInstance().getmDaoSession().queryBuilder(TencentUserBean.class).where(TencentUserBeanDao.Properties.Identify.eq(identify)).list();
    }

    /**
     * 查询所有数据
     *
     * @return
     */
    public static List<TencentUserBean> queryAll() {
        return GreenDaoManager.getInstance().getmDaoSession().loadAll(TencentUserBean.class);
    }


}
